package avpc

import (
	"fmt"

	"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc"
)

// AllocateEipAddress申请弹性公网IP
func (c *Client) AllocateEipAddress(req *vpc.AllocateEipAddressRequest) (*vpc.AllocateEipAddressResponse, error) {
	client := c.Client
	req.Method = "GET"
	req.Port = c.Port
	response, err := client.AllocateEipAddress(req)
	if err != nil {
		return nil, fmt.Errorf("Error creating instance %w", err)
	}

	return response, nil
}
